<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    
    <head>
        <meta charset="utf-8">
        <title>
            X-admin v1.0
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="/yuephp/adh/Public/Admin/css/x-admin.css" media="all">
        <style type="text/css">
            .x-mid{
                background: #41A6EA url() 0 0 no-repeat;
            }
            .x-box{
                background: #41A6EA url() 0 0 no-repeat;
            }
            #logo{
                margin: 0px 32px;
            }
            #verify{
                width: 70px;
                height: 38px;
            }
            #loginbtn .layui-btn{
                width: 195.7px;
                margin: 0px;
            }
            #loginbtn .layui-btn-warm{
                background: #F7B824 url() 0 0 no-repeat;
            }
            .x-login-box input{
                font-size: 17px;
            }
        </style>
    </head>
    
    <body style="background-color: #393D49">
        <div class="x-box">
            <div class="x-top">
                <i class="layui-icon x-login-close">
                    &#x1007;
                </i>
                <ul class="x-login-right">
                    <li style="background-color: #F1C85F;" color="#F1C85F">
                    </li>
                    <li style="background-color: #EA569A;" color="#EA569A">
                    </li>
                    <li style="background-color: #393D49;" color="#393D49">
                    </li>
                </ul>
            </div>
            <div class="x-mid">
                <div class=""><!-- x-avtar -->
                    <img id="logo" src="/yuephp/adh/Public/Admin/images/adhlogo.png" alt="">
                </div>
                <div class="input">
                    <form class="layui-form">
                        <div class="layui-form-item x-login-box">
                            <label for="username" class="layui-form-label">
                                <i class="layui-icon">&#xe612;</i>
                            </label>
                            <div class="layui-input-inline">
                                <input type="text" id="username" name="username" required="" lay-verify="username"
                                autocomplete="off" placeholder="      请输入用户名" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item x-login-box">
                            <label for="pass" class="layui-form-label">
                                <i class="layui-icon">&#xe628;</i>
                            </label>
                            <div class="layui-input-inline">
                                <input type="password" id="pass" name="password" required="" lay-verify="pass"
                                autocomplete="off" placeholder="        请输入密码" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item x-login-box">
                            <label for="pass" class="layui-form-label">
                                <i class="layui-icon">&#xe600;</i>
                            </label>
                            <div class="layui-input-inline">
                                <input type="text" id="" name="verifycode" required="verifycode" lay-verify="verifycode"
                                autocomplete="off" placeholder="      请输入验证码" class="layui-input">
                            </div>
                        
                            <img id="verify" src="index.php/admin/login/verify" alt="" onclick="this.src='index.php/admin/login/verify?'+Math.random()" title="看不清,点击换一张">

                        </div>
                        <div class="layui-form-item" id="loginbtn">
                            <button  class="layui-btn" lay-filter="login" lay-submit="">
                                登 录
                            </button>
                            <button type="reset" class="layui-btn layui-btn-warm" lay-filter="" lay-submit="">
                                重 置
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <p style="color:#fff;text-align: center;">Copyright © 2017.Company name All rights X-admin </p>
        <script src="/yuephp/adh/Public/Admin/lib/layui/layui.js" charset="utf-8">
        </script>
        <script>
            layui.use(['form'],
            function() {
                $ = layui.jquery;
                var form = layui.form(),
                layer = layui.layer;

                $('.x-login-right li').click(function(event) {
                    color = $(this).attr('color');
                    $('body').css('background-color', color);
                });

                //监听提交
                form.on('submit(login)',
                function(data) {
                    console.log(data);
                    // layer.alert(JSON.stringify(data.field), {
                    //   title: '最终的提交信息'
                    // },function  () {
                    //     location.href = "./index.html";
                    // })
                    $.ajax({
                        url: '<?php echo U('Admin/login/checkdata');?>',
                        type: 'POST',
                        dataType: 'json',
                        data: data.field,
                    })
                    .done(function(res) {
                        //console.log("success");
                        if (res.error==1) {
                            //提示层
                            layer.msg(res.info,function() {
                                //关闭后的操作
                            })
                        }else{
                            //信息框-例1           //点击确定后执行的回调函数
                            layer.alert(res.info, {icon: 6},function() {
                                location.replace('<?php echo U('admin/index/index');?>')
                            });
                        }

                    })
                    .fail(function() {
                        console.log("error");
                    })

                    


                    return false;
                });

            });

        </script>
    </body>

</html>